<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>编写留言</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>

<body>
<%@include file="window.jsp" %>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">编写留言</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-row">
                        <div class="layui-col-md10">
                            <form enctype="multipart/form-data"
                            action="/Message/Insert"
                           >
                                    <div >
                                        <textarea id="content" style="display: none;" ></textarea>
                                        <input  type="hidden" id="inputtext" name="inputtext">
                                    </div>

<br>
                                    <div class="layui-form-item" align="center">
                                        <div class="layui-input-block">
                                            <button   type="submit"
                                                   class="layui-btn site-demo-layedit"
                                                     data-type="content"
                                                  >确认提交
                                            </button>
                                            <button type="reset"
                                                    class="layui-btn layui-btn-primary">
                                                重新填写
                                            </button>
                                        </div>
                                    </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layui/layui.js"></script>
<script>
    layui.use(['form', 'upload'], function () {
        var form = layui.form;
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#LAY_avatarUpload' //绑定元素
            , url: '/upload/' //上传接口
            , done: function (res) {
                //上传完毕回调
            }
            , error: function () {
                //请求异常回调
            }
        });


        //各种基于事件的操作，下面会有进一步介绍
    });

    layui.use('layedit', function(){
        var layedit = layui.layedit,$=layui.jquery;
        var index = layedit.build('content'); //建立编辑器
        var active={
            content:function (){

                $("#inputtext").val(layedit.getContent(index));

                       }
        }

        $('.site-demo-layedit').on('click',function (){
            var type=$(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });



</script>
</body>

</html>